Skip to content

Add GitHub Actions CI/CD workflows for build/test and code coverage#4

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-github-actions-workflows
Draft

Add GitHub Actions CI/CD workflows for build/test and code coverage#4
Copilot wants to merge 2 commits intomasterfrom
copilot/add-github-actions-workflows

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

Adds automated CI pipelines for a CMake/GTest C++ project with no existing GitHub Actions setup.

Workflows

build-and-test.yml

  • Triggers on push/PR to master
  • Configures via existing default CMake preset (Release), builds, and runs all three test suites (compiler_tests, linker_tests, runtime_tests) with --output-on-failure

coverage.yml

  • Triggers on push/PR to master
  • Builds in Debug mode with --coverage instrumentation, generates lcov report (excluding /usr/*, googletest, vrEmu6502, tests), uploads to Codecov via ${{ secrets.CODECOV_TOKEN }}

Security

Both jobs scope GITHUB_TOKEN to permissions: contents: read.

Original prompt

Add GitHub Actions workflows for CI/CD to automate build, test, and code coverage reporting.

Requirements

Create two GitHub Actions workflows:

1. Build and Test Workflow (.github/workflows/build-and-test.yml)

  • Trigger on push and pull requests to master branch
  • Run on Ubuntu latest
  • Install CMake and Ninja
  • Configure and build the project with CMake
  • Run all tests using CTest with failure reporting
  • Provide clear output on test failures

2. Code Coverage Workflow (.github/workflows/coverage.yml)

  • Trigger on push and pull requests to master branch
  • Run on Ubuntu latest
  • Install CMake, Ninja, and lcov for coverage tracking
  • Build project with coverage flags (--coverage)
  • Generate coverage report using lcov
  • Upload coverage results to Codecov
  • Provide visibility into test coverage metrics

Context

The nixie repository is a 65C02 compiler/language project (98% C++) with:

  • CMake-based build system with presets
  • Comprehensive test suite: compiler_tests, linker_tests, runtime_tests
  • GTest framework for testing
  • CTest test runner integration

Both workflows should be placed in .github/workflows/ directory and will help maintain code quality and prevent regressions.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: what github actions should i add to my repository (please analyze it to see what fits)

Assistant: I'll analyze your repository to understand its structure and recommend appropriate GitHub Actions for your C++ project.

Assistant: Based on my analysis of your repository, here are the GitHub Actions I recommend adding to divinepablo/nixie:

Recommended GitHub Actions

1. Continuous Integration (CI) - Build & TestHIGH PRIORITY

Your repository has:

  • CMake build system with test infrastructure (compiler_tests, linker_tests, runtime_tests)
  • GTest test framework already integrated
  • Three test suites using CTest

Recommended Action: build-and-test.yml

on: [push, pull_request]

jobs:
  build-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y cmake ninja-build
      - name: Build
        run: |
          mkdir -p build && cd build
          cmake ..
          cmake --build . --config Release
      - name: Run tests
        run: ctest --test-dir build --output-on-failure

2. Code CoverageHIGH PRIORITY

Since you have comprehensive tests, track coverage to ensure quality:

Recommended Action: coverage.yml

on: [push, pull_request]

jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y cmake ninja-build lcov
      - name: Build with coverage
        run: |
          mkdir -p build && cd build
          cmake -DCMAKE_CXX_FLAGS="--coverage" ..
          cmake --build .
      - name: Generate coverage report
        run: lcov --directory build --capture --output-file coverage.info
      - name: Upload to Codecov
        uses: codecov/codecov-action@v3
        with:
          files: ./coverage.info

3. Multi-Platform Build Matrix 🔧 MEDIUM PRIORITY

Your CMakeUserPresets include Clang configuration—test across platforms:

Recommended Action: multi-platform.yml

on: [push, pull_request]

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Install CMake
        uses: lukka/get-cmake@latest
      - name: Build
        run: |
          mkdir -p build && cd build
          cmake ..
          cmake --build . --config Release
      - name: Run tests
        run: ctest --test-dir build --output-on-failure

4. Linting & Static Analysis 🔍 MEDIUM PRIORITY

98% C++ means enforcing code quality:

Recommended Action: lint.yml

on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install clang-format
        run: sudo apt-get install -y clang-format
      - name: Check code formatting
        run: |
          find . -name "*.cpp" -o -name "*.hpp" | xargs clang-format --dry-run --Werror
      - name: Install cppcheck
        run: sudo apt-get install -y cppcheck
      - name: Run cppcheck
        run: cppcheck --enable=all src/ tests/

5. VS Code Extension Publishing (Optional) ⚙️ LOW PRIORITY

You have a nixie-extension package:

Recommended Action: publish-extension.yml

on:
  push:
    tags:
      - 'v*'

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Publish to VS Code Marketplace
        uses: HaaLeo/publis...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

📱 Kick off Copilot coding agent tasks wherever you are with [GitHub Mobile](https://gh.io/cca-mobile-docs), available on iOS and Android.

Co-authored-by: divinepablo <87882202+divinepablo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflows for CI/CD automation Add GitHub Actions CI/CD workflows for build/test and code coverage Mar 14, 2026
Copilot AI requested a review from divinepablo March 14, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants